<template>
	<view class="trade-buy">
		<view class="trade-buy-list">
               <view class="tbl tbl-item van-hairline--top-bottom"
                	v-for="(key, index) in buys" :key="index"
					>
                	<view class="tbl-item-info" @click="qwqw">
                		<view class="tbl-item-info-id">
                			<view class="tbl-item-info-oid">
                				<text>td-20190230</text>
                				<text class="time">2019-02-30 8:30</text>
                			</view>
                		</view>
                		<view class="tbl-item-info-sum">
                			<text>100 积分</text> 
                		</view>
                	</view>
                	<view class="tbl-item-btn">
                		<van-button type="default" custom-class="btn-col" size="small" @click="onBuy(key)">购买</van-button>
                	</view>
                </view>
				<loadding-more :noData="false" :loadEnd="loadEnd"></loadding-more>
		</view>
		<van-dialog
		  use-slot
		  :show="dialogShow"
		  :closeOnClickOverlay="true"
		  show-cancel-button
		  confirm-button-open-type="getUserInfo"
		  @close="onClose"
		  @getuserinfo="getUserInfo"
		>
		<view class="dialog-info">
			<view class="dialog-info-title">积分购买</view>
			<view class="dialog-info-text van-hairline--bottom">
				<view class="dit"><text class="name">订单号</text>: td-20190230</text></view>
				<view class="dit"><text class="name">数量</text><text>: 100积分</text></view>
				<view class="dit"><text class="name">支付</text><text>: 90美金</text></view>
			</view>
		</view>
		<van-field
		  type="password"
		  label="密码"
		  :border="false"
		  placeholder="请输入交易密码"
		/>
		</van-dialog>

	</view>
</template>
<script>
	import LoaddingMore from '../../../components/loadding-more.vue'
	export default {
		props: {
			active: {
				type: Number,
			}
		},
		data() {
			return {
				buys: [],
				dialogShow: false,
				password: '',
				sds: 10,
				loadEnd: false
			}
		},
		onShow () {
			this.gitList()
		},
		onReachBottom () {
			this.gitList()
			this.sds += 10
		},
		methods: {
			onChangeTab () {
				
			},
			gitList () {
				if (this.active !== 0) return false
				setTimeout(() => {
					for(let i = 0; this.buys.length < this.sds; i++) {
						this.buys.push(1)
					}
				}, 1000)
			},
			onClose () {
				this.dialogShow = false
			},
			onBuy (key) {
				this.dialogShow = true
			}
		},
		components: {
			LoaddingMore
		}
	}
</script>
<style scoped lang="scss">
@import '../../../common/integral-trade.scss';
.dialog-info {
	&-title {
		padding: 20upx 0;
		text-align: center;
		font-size: 34upx;
		font-weight: 500;
	}
	&-text{
		padding: 0 40upx 30upx 40upx;
		.dit {
			display: flex;
			align-items: center;
			.name {
				width: 100upx;
				height: 40upx;
				font-size: 32upx;
				color: #9b9b9b;
				line-height: 40upx;
				text-align: justify;
				text-align-last:justify;
				&:after{
					content: '';
					display: inline-block;
					width: 100%;
				}
		
			}
		}
	}
}
</style>
